﻿using Grishko.DataTier;
using OutdoorLib.BaseEntity.BusinesRules;
using OutdoorLib.BaseEntity.Contract;
using OutdoorLib.BaseEntity.Constraction;

namespace OutdoorLib.BaseEntity.WS
{   
    class wsBusinesEngine:EntitySingle
    {
        

        public virtual BusinesRulesEngine GetBusinesRulesEngine(BusinessRulesEntity BusinessRulesEntity)
        {
            if (BusinessRulesEntity is ContractEntity || BusinessRulesEntity is ContractSurfaceItem)
                return Get_Contract_BusinesRulesEngine(BusinessRulesEntity);

            if (BusinessRulesEntity is ConstractionEntity)
                return Get_Constraction_BusinesRulesEngine(BusinessRulesEntity);

          
            return new BusinesRulesEngine ();

        }

        protected  virtual  Constraction_BusinesRulesEngine Get_Constraction_BusinesRulesEngine(BusinessRulesEntity BusinessRulesEntity)
        {
            return new Constraction_BusinesRulesEngine() { Owner = BusinessRulesEntity };
        }

        protected virtual Contract_BusinesRulesEngine Get_Contract_BusinesRulesEngine(BusinessRulesEntity BusinessRulesEntity)
        {
            return new Contract_BusinesRulesEngine() { Owner = BusinessRulesEntity };
        }
        
    }
}
